﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DataContexts.Supplier;

public partial class Admin_ViewRegions : System.Web.UI.Page
{
    SupplierDataContext supplierContext = new SupplierDataContext();

    protected void Page_Load(object sender, EventArgs e)
    {
        ((BaseMasterPage)this.Master).CurrentPage = PageConfig.Pages.AdminRegionDefault;
        if (!((BaseMasterPage)this.Master).AuthorizeCurrentUser())
            return;
        
        if (!IsPostBack)
        {
            gvRegion.DataSource = from r in supplierContext.Regions
                                  join c in supplierContext.Countries on r.CountryId equals c.CountryId
                                  select new { r.RegionId, r.RegionName, CountryID = c.CountryName}; 
            gvRegion.DataBind();
        }
    }
    protected void gvRegion_RowDataBound(object sender, GridViewRowEventArgs e)
    {

    }
}
